package com.cloudbroker.openapi.manage.controller;

import com.cloudbroker.bcs.common.entity.HSBCPSBackVO;
import com.cloudbroker.bcs.common.util.IPUtil;
import com.cloudbroker.bcs.common.util.VOUtil;
import com.cloudbroker.bcs.csvc.lightinvesting.api.service.LedThreeService;
import com.cloudbroker.bcs.csvc.lightinvesting.api.t2service.LedT2Service;
import com.cloudbroker.bcs.csvc.lightinvesting.api.t2service.LedThreeT2Service;
import com.cloudbroker.bcs.csvc.lightinvesting.api.vo.request.baseRelevanted.BasicUserInfoForm;
import com.cloudbroker.bcs.csvc.lightinvesting.api.vo.request.baseRelevanted.MessageAndNoticeForm;
import com.cloudbroker.bcs.csvc.lightinvesting.api.vo.request.baseRelevanted.TradLoginForm;
import com.cloudbroker.bcs.csvc.lightinvesting.api.vo.request.cashTransactions.AvailableMoneyForm;
import com.cloudbroker.bcs.csvc.lightinvesting.api.vo.request.cashTransactions.BindCapitalAccountForm;
import com.cloudbroker.bcs.csvc.lightinvesting.api.vo.request.cashTransactions.LoginAuthForm;
import com.cloudbroker.bcs.csvc.lightinvesting.api.vo.request.cashTransactions.UnbundCapitalAccountForm;
import com.cloudbroker.bcs.csvc.lightinvesting.api.vo.request.fansRelated.*;
import com.cloudbroker.bcs.csvc.lightinvesting.api.vo.request.interestRelated.*;
import com.cloudbroker.bcs.csvc.lightinvesting.api.vo.response.*;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.leader.back.ComuserSignQryList;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.leader.vo.MiddleComuserSignQryForm;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.leader.vo.MiddleUserAdviserHisQryForm;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.pay.back.PayApplyBack;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.pay.back.PayConfirmBack;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.pay.back.PingPlusPayApplyBack;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.pay.vo.*;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.transaction.back.DongbeiPayHtmlBack;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.transaction.back.DongbeiSignCallbackBack;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.transaction.back.DongbeiSignStatusBack;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.transaction.vo.*;
import com.cloudbroker.bcs.platform.ltb.bizapi.t2service.admin.AdminBannerT2BizService;
import com.cloudbroker.bcs.platform.ltb.bizapi.t2service.admin.AdminPushT2BizService;
import com.cloudbroker.bcs.platform.ltb.bizapi.t2service.business.LeaderT2BizService;
import com.cloudbroker.bcs.platform.ltb.bizapi.t2service.transaction.ComUserSignT2BizService;
import com.cloudbroker.bcs.platform.ltb.bizapi.t2service.transaction.CombineT2BizService;
import com.cloudbroker.bcs.platform.ltb.bizapi.t2service.transaction.PayT2BizService;
import com.cloudbroker.bcs.platform.ltb.common.ext.annotation.SaveLog;
import com.cloudbroker.bcs.platform.ltb.common.util.RequestUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;

import static com.cloudbroker.bcs.platform.ltb.common.util.RequestUtil.getSingleParameterMapForBody;
/**
 * Created by fangyf18371 on 2016/7/21.
 */
@Controller
public class TransactionController {
        @Resource
        private LedT2Service ledT2Service;
        @Resource
        private ComUserSignT2BizService comUserSignT2BizService;
        @Resource
        private LeaderT2BizService leaderT2BizService;
        @Resource
        private PayT2BizService payT2BizService;
        @Resource
        private CombineT2BizService combineT2BizService;
        @Resource
        private AdminPushT2BizService adminPushT2BizService;
        @Resource
        private AdminBannerT2BizService adminBannerT2BizService;

        @Resource
        private LedThreeT2Service ledThreeT2Service;


        /**
         * 组合申请
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/combine_apply")
        @SaveLog(remark = "组合申请")
        public CombineApplyVo func_combine_apply(HttpServletRequest request, String jsonpcallback){
                CombineApplyForm form = getSingleParameterMapForBody(request , CombineApplyForm.class);
                return VOUtil.setJsonpResult(ledT2Service.func_combine_apply(form), jsonpcallback);
        }

        /**
         * 个股委托
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/comentrust_detail_order_enter")
        @SaveLog(remark = "个股委托")
        public StocksEntrustVo func_stock_entrust_add(HttpServletRequest request, String jsonpcallback){
                StocksEntrustForm form = getSingleParameterMapForBody(request , StocksEntrustForm.class);
                return VOUtil.setJsonpResult(ledT2Service.func_stock_entrust_add(form), jsonpcallback);
        }
        /**
         * 组合委托
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/comentrust_order_enter")
        @SaveLog(remark = "组合委托")
        public CombEntrustVo func_comb_entrust_add(HttpServletRequest request, String jsonpcallback){
                CombEntrustTransForm form = getSingleParameterMapForBody(request , CombEntrustTransForm.class);
        //                MiddleCombEntrustForm form = getSingleParameterMapForBody(request , MiddleCombEntrustForm.class);
        //                return VOUtil.setJsonpResult(ledT2Service.func_comb_entrust_add(form), jsonpcallback);
                return VOUtil.setJsonpResult(combineT2BizService.func_comb_entrust_add(form), jsonpcallback);
        }


        /**
         * 批量个股委托
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/batch_stock_entrust")
        @SaveLog(remark = "批量个股委托")
        public BatchStocksEntrustVo func_batch_stock_entrust(HttpServletRequest request, String jsonpcallback){
                BatchStocksEntrustForm form = getSingleParameterMapForBody(request , BatchStocksEntrustForm.class);
                return VOUtil.setJsonpResult(ledT2Service.func_batch_stock_entrust(form), jsonpcallback);
        }

        /**
         * 用户已收藏组合查询，即关注的组合
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/combine_collect_info_qry")
        @SaveLog(remark = "用户已收藏组合查询")
        public FocusCombineQryBackVo func_combine_collect_info_qry(HttpServletRequest request, String jsonpcallback){
                FocusCombineForm form = getSingleParameterMapForBody(request , FocusCombineForm.class);
                return VOUtil.setJsonpResult(ledT2Service.func_combine_collect_info_qry(form), jsonpcallback);
        }

        /**
         * 用户已收藏投顾查询，即关注的投顾
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/comuser_collect_qry")
        @SaveLog(remark = "用户已收藏投顾查询")
        public FocusInterestQryBackVo func_interest_focus(HttpServletRequest request, String jsonpcallback){
                ComUserCollectForm form = getSingleParameterMapForBody(request , ComUserCollectForm.class);
                return VOUtil.setJsonpResult(leaderT2BizService.func_interest_focus(form), jsonpcallback);
        //                return VOUtil.setJsonpResult(ledT2Service.func_interest_focus(form), jsonpcallback);
        }

        /**
         * 已关注组合信息查询，即已订阅的组合
         * @param
         * @return
         */

        @ResponseBody
        @RequestMapping("/combine_focus_info_qry")
        @SaveLog(remark = "已关注组合信息查询")
        public SubscriptionCombineQryBackVo func_comb_subscription(HttpServletRequest request, String jsonpcallback){
                MiddleSubscriptionCombineForm form = getSingleParameterMapForBody(request , MiddleSubscriptionCombineForm.class);
                return VOUtil.setJsonpResult(combineT2BizService.func_comb_subscription(form), jsonpcallback);
        //                return VOUtil.setJsonpResult(ledT2Service.func_comb_subscription(form), jsonpcallback);
        }

        /**
         * 组合基本信息查询，即组合详情
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/combine_basic_info_qry")
        @SaveLog(remark = "组合详情")
        public CombDetailQryBackVo func_comb_details( HttpServletRequest request, String jsonpcallback){
                CombDetailForm form = getSingleParameterMapForBody(request , CombDetailForm.class);
                return VOUtil.setJsonpResult(ledT2Service.func_comb_details(form), jsonpcallback);
        }
        //        public MiddleCombineBasicInfoList func_comb_details ( HttpServletRequest request, String jsonpcallback){
        //            CombineMidBasicInfoform form = getSingleParameterMapForBody(request, CombineMidBasicInfoform.class);
        //            return VOUtil.setJsonpResult(combineT2BizService.combineBasicInfo(form), jsonpcallback);
        //        }

        /**
         * 组合推荐信息查询
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/combine_recommend_qry")
        @SaveLog(remark = "组合推荐信息查询")
        public RecommendedCombQryBackVo func_comb_recommend( HttpServletRequest request, String jsonpcallback){
                RecommendedCombForm form = getSingleParameterMapForBody(request , RecommendedCombForm.class);
                return VOUtil.setJsonpResult(ledT2Service.func_comb_recommend(form), jsonpcallback);
        }

        /**
         * 组合排名
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/combine_order_qry")
        @SaveLog(remark = "组合排名")
        public CombRankQryBackVo func_comb_rank( HttpServletRequest request, String jsonpcallback){
            CombineRankForm form = getSingleParameterMapForBody(request , CombineRankForm.class);
            return VOUtil.setJsonpResult(combineT2BizService.func_comb_rank(form), jsonpcallback);
        }

        /**
         * 组合关注，即领投宝的组合订阅
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/combine_focus")
        @SaveLog(remark = "组合订阅")
        public CombSubscribeVo func_combine_focus(HttpServletRequest request, String jsonpcallback){
                CombSubscribeTransForm form = getSingleParameterMapForBody(request , CombSubscribeTransForm.class);
                return VOUtil.setJsonpResult(combineT2BizService.func_combine_focus(form), jsonpcallback);
        }


        /**
         * 组合关注取消，即领投宝组合订阅取消
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/combine_focus_cancel")
        @SaveLog(remark = "组合订阅取消")
        public CombSubscribeCancelVo func_combine_focus_cancel(HttpServletRequest request, String jsonpcallback){
                MiddleCombSubscribeCancelForm form = getSingleParameterMapForBody(request , MiddleCombSubscribeCancelForm.class);
                return VOUtil.setJsonpResult(combineT2BizService.func_combine_focus_cancel(form), jsonpcallback);
//                return VOUtil.setJsonpResult(ledT2Service.func_combine_focus_cancel(form), jsonpcallback);
        }

        /**
         * 组合历史收益率查询
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/combine_his_incomeratio_qry")
        @SaveLog(remark = "组合历史收益率查询")
        public CombHistoryYieldQryBackVo func_comb_history_Yyield_query(HttpServletRequest request, String jsonpcallback){
                CombHistoryYieldForm form = getSingleParameterMapForBody(request , CombHistoryYieldForm.class);
                return VOUtil.setJsonpResult(ledT2Service.func_comb_history_Yyield_query(form), jsonpcallback);
        }

        /**
         * 组合关闭申请
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/combineclose_apply")
        @SaveLog(remark = "组合关闭申请")
        public CombApplyCloseVo func_comb_apply_close(HttpServletRequest request, String jsonpcallback){
                CombApplyCloseForm form = getSingleParameterMapForBody(request , CombApplyCloseForm.class);
                return VOUtil.setJsonpResult(ledT2Service.func_comb_apply_close(form), jsonpcallback);
        }

        /**
         * 组合费用参数查询，即领投宝的组合费用查询
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/combine_farearg_qry")
        @SaveLog(remark = "组合费用参数查询")
        public CombCostVo func_comb_cost_query(HttpServletRequest request, String jsonpcallback){
                CombCostForm form = getSingleParameterMapForBody(request , CombCostForm.class);
                return VOUtil.setJsonpResult(ledT2Service.func_comb_cost_query(form), jsonpcallback);
        }

        /**
         * 组合信息修改申请，即领投宝的组合信息修改
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/combine_mod_apply")
        @SaveLog(remark = "组合信息修改申请")
        public ModCombInfoVo func_comb_info_mod(HttpServletRequest request, String jsonpcallback){
                ModCombInfoForm form = getSingleParameterMapForBody(request , ModCombInfoForm.class);
                return VOUtil.setJsonpResult(ledT2Service.func_comb_info_mod(form), jsonpcallback);
        }

        /**
         * 客户资金精确查询，即领投宝的可用资金查询
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/balancefast_qry")
        @SaveLog(remark = "客户资金精确查询")
        public AvailableMoneyQryBackVo func_available_money_query(HttpServletRequest request, String jsonpcallback){
                AvailableMoneyForm form = getSingleParameterMapForBody(request , AvailableMoneyForm.class);
                return VOUtil.setJsonpResult(ledT2Service.func_available_money_query(form), jsonpcallback);
        }

        /**
         * 证券持仓查询，即领投宝的可用持仓
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/stock_qry")
        @SaveLog(remark = "证券持仓查询")
        public PositionQryBackVo func_position_query(HttpServletRequest request, String jsonpcallback){
                PositionForm form = getSingleParameterMapForBody(request , PositionForm.class);
                return VOUtil.setJsonpResult(ledT2Service.func_position_query(form), jsonpcallback);
        }

        /**
         * 用户委托明细查询，即领投宝的当日调仓记录
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/comentrust_detail_qry")
        @SaveLog(remark = "用户委托明细查询")
        public WarehouseByDayQryBackVo func_warehouse_day_query(HttpServletRequest request, String jsonpcallback){
                WarehouseByDayForm form = getSingleParameterMapForBody(request , WarehouseByDayForm.class);
                return VOUtil.setJsonpResult(ledT2Service.func_warehouse_day_query(form), jsonpcallback);
        }

        /**
         * 用户委托明细历史查询，即领投宝的历史调仓记录
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/comentrust_detail_his_qry")
        @SaveLog(remark = "用户委托明细历史查询")
        public WarehouseByHistoryQryBackVo func_warehouse_history_query(HttpServletRequest request, String jsonpcallback){
                WarehouseByHistoryForm form = getSingleParameterMapForBody(request , WarehouseByHistoryForm.class);
                return VOUtil.setJsonpResult(ledT2Service.func_warehouse_history_query(form), jsonpcallback);
        }

        /**
         * 资产账户绑定，即领投宝的绑定资金账号
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/businacct_bind")
        @SaveLog(remark = "资产账户绑定")
        public BindCapitalAccountVo func_capital_account_bind(HttpServletRequest request, String jsonpcallback){
                BindCapitalAccountForm form = getSingleParameterMapForBody(request , BindCapitalAccountForm.class);
                return VOUtil.setJsonpResult(ledT2Service.func_capital_account_bind(form), jsonpcallback);
        }

        /**
         * 资产账户解绑，即领投宝的解绑资金账号
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/businacct_unbind")
        @SaveLog(remark = "资产账户解绑")
        public UnbundCapitalAccountQryBackVo func_capital_account_unbund(HttpServletRequest request, String jsonpcallback){
                UnbundCapitalAccountForm form = getSingleParameterMapForBody(request , UnbundCapitalAccountForm.class);
                return VOUtil.setJsonpResult(ledT2Service.func_capital_account_unbund(form), jsonpcallback);
        }

        /**
         * 客户登录，即领投宝的交易登录
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/channel_login")
        @SaveLog(remark = "客户登录")
        public TradLoginVo func_trad_login(HttpServletRequest request, String jsonpcallback){
                TradLoginForm form = getSingleParameterMapForBody(request , TradLoginForm.class);
                return VOUtil.setJsonpResult(ledT2Service.func_trad_login(form), jsonpcallback);
        }

        /**
         * 达人推荐信息查询，即领投宝的推荐投顾
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/comuser_recommend_qry")
        @SaveLog(remark = "达人推荐信息查询")
        public RecommendInterestQryBackVo func_recommend_interest_query(HttpServletRequest request, String jsonpcallback){
                LeaderRecommendForm form = getSingleParameterMapForBody(request , LeaderRecommendForm.class);
                return VOUtil.setJsonpResult(leaderT2BizService.comuser_recommend_qry(form), jsonpcallback);
        //                return VOUtil.setJsonpResult(ledT2Service.func_recommend_interest_query(form), jsonpcallback);
        }

        /**
         * 达人排名，即领投宝的投顾排名
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/comadviser_order_qry")
        @SaveLog(remark = "达人排名")
        public InterestRankQryBackVo func_interest_rank_query(HttpServletRequest request, String jsonpcallback){
                LeaderRankForm form = getSingleParameterMapForBody(request , LeaderRankForm.class);
                return VOUtil.setJsonpResult(leaderT2BizService.func_interest_rank_query(form), jsonpcallback);
        //                return VOUtil.setJsonpResult(ledT2Service.func_interest_rank_query(form), jsonpcallback);
        }

        /**
         * 投顾收藏，即领投宝的投顾关注
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/comuser_collect")
        @SaveLog(remark = "投顾收藏")
        public InterestFocusVo func_focus_interest_add(HttpServletRequest request, String jsonpcallback){
                FocusInterestByTransForm form = getSingleParameterMapForBody(request , FocusInterestByTransForm.class);
                return VOUtil.setJsonpResult(combineT2BizService.func_focus_interest_add(form), jsonpcallback);
        }

        /**
         * 达人信息查询，即领投宝的投顾详情
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/comadviser_qry")
        @SaveLog(remark = "投顾详情")
        public InterestDetailVo func_interest_detail_query(HttpServletRequest request, String jsonpcallback){
                InterestDetailForm form = getSingleParameterMapForBody(request , InterestDetailForm.class);
                return VOUtil.setJsonpResult(ledT2Service.func_interest_detail_query(form), jsonpcallback);
        }

        /**
         * 达人历史收益率查询，即领投宝的投顾历史收益率
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/comuser_his_incomeratio_qry")
        @SaveLog(remark = "投顾历史收益率")
        public InterestHistoryYieldQryBackVo func_interest_history_yield_query(HttpServletRequest request, String jsonpcallback){
                InterestHistoryYieldForm form = getSingleParameterMapForBody(request , InterestHistoryYieldForm.class);
                return VOUtil.setJsonpResult(ledT2Service.func_interest_history_yield_query(form), jsonpcallback);
        }

        /**
         * 用户消息通知查询，即领投宝的消息通知
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/extcomdata_notify_qry")
        @SaveLog(remark = "用户消息通知查询")
        public MessageAndNoticeQryBackVo  func_message_and_notice_get(HttpServletRequest request, String jsonpcallback){
                MessageAndNoticeForm form = getSingleParameterMapForBody(request , MessageAndNoticeForm.class);
                return VOUtil.setJsonpResult(ledT2Service.func_message_and_notice_get(form), jsonpcallback);
        }


        //        /**
        //         * 投顾认证
        //         * @param
        //         * @return
        //         */
        //        @ResponseBody
        //        @RequestMapping("/comacct_adviser_add")
        //        @SaveLog(remark = "comacct_adviser_add")
        //        public InterestCertVo func_interest_cert__add(HttpServletRequest request, String jsonpcallback){
        //                InterestCertForm form = getSingleParameterMapForBody(request , InterestCertForm.class);
        //                return VOUtil.setJsonpResult(ledT2Service.func_interest_cert__add(form), jsonpcallback);
        //        }

        /**
        *组合成分查询
        * @param request
        * @param jsonpcallback
        * @return
        */
        @ResponseBody
        @RequestMapping("/combine_detail_info_qry")
        @SaveLog(remark = "组合成分查询")
        public CombCompositionVo func_comb_composition_query(HttpServletRequest request, String jsonpcallback){
                CombCompositionForm form = getSingleParameterMapForBody(request , CombCompositionForm.class);
                return VOUtil.setJsonpResult(ledT2Service.func_comb_composition_query(form), jsonpcallback);
        }

        /**
         *组合历史调仓记录查询
         * @param request
         * @param jsonpcallback
         * @return
         */
        @ResponseBody
        @RequestMapping("/comb_his_comentrust")
        @SaveLog(remark = "组合历史调仓记录查询")
        public CombHisComentrustQryBackVo func_comb_his_comentrust(HttpServletRequest request, String jsonpcallback) {
                CombHisComentrustForm form = getSingleParameterMapForBody(request , CombHisComentrustForm.class);
                return VOUtil.setJsonpResult(ledT2Service.func_comb_his_comentrust(form), jsonpcallback);
        }

        /**
         * 达人签约
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/comuser_sign")
        @SaveLog(remark = "达人签约")
        public ComuserSignVo func_comuser_sign(HttpServletRequest request, String jsonpcallback){
        //                com.cloudbroker.bcs.platform.ltb.bizapi.service.transaction.vo.ComuserSignForm form = getSingleParameterMapForBody(request , ComuserSignForm.class);
        ////            ComuserSignForm form=getSingleParameterMapForBody(request,ComuserSignForm.class);
        //            ComuserSignForm form=getSingleParameterMapForBody(request,ComuserSignForm.class);
        //                return VOUtil.setJsonpResult(comUserSignT2BizService.comUserSigh(form), jsonpcallback);
        //            return VOUtil.setJsonpResult(ledT2Service.func_comuser_sign(form),jsonpcallback);
            MiddleComuserSignForm form=getSingleParameterMapForBody(request,MiddleComuserSignForm.class);
            return VOUtil.setJsonpResult(comUserSignT2BizService.comUserSigh(form), jsonpcallback);

        }

        /**
         * 达人解约
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/comuser_sign_cancel")
        @SaveLog(remark = "达人解约")
        public ComuserSignCancelVo func_comuser_sign_cancel(HttpServletRequest request, String jsonpcallback){
                MiddleComuserSignCancelForm form = getSingleParameterMapForBody(request , MiddleComuserSignCancelForm.class);
                return VOUtil.setJsonpResult(comUserSignT2BizService.func_comuser_sign_cancel(form), jsonpcallback);
//                return VOUtil.setJsonpResult(ledT2Service.func_comuser_sign_cancel(form), jsonpcallback);
        }

        /**
         * 达人已签约客户查询
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/comadviser_sign_qry")
        @SaveLog(remark = "达人已签约客户查询")
        public ComadviserSignQryBackVo func_comadviser_sign_qry(HttpServletRequest request, String jsonpcallback){
                ComadviserSignQryForm form = getSingleParameterMapForBody(request , ComadviserSignQryForm.class);
                return VOUtil.setJsonpResult(ledT2Service.func_comadviser_sign_qry(form), jsonpcallback);
        }

        /**
         * 用户费用参数设置
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/extcomacct_farearg_set")
        @SaveLog(remark = "用户费用参数设置")
        public FareargVo func_farearg_set(HttpServletRequest request, String jsonpcallback){
                FareargFrom form = getSingleParameterMapForBody(request , FareargFrom.class);
                return VOUtil.setJsonpResult(ledT2Service.func_farearg_set(form), jsonpcallback);
        }

        /**
         * 用户费用参数查询
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/extcomacct_farearg_qry")
        @SaveLog(remark = "用户费用参数查询")
        public FareargQryVo func_farearg_qry(HttpServletRequest request, String jsonpcallback){
                FareargQryForm form = getSingleParameterMapForBody(request , FareargQryForm.class);
                return VOUtil.setJsonpResult(ledT2Service.func_farearg_qry(form), jsonpcallback);
        }

        /**
         * 用户已签约达人查询(封装用户头像)
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/comuser_sign_qry")
        @SaveLog(remark = "用户已签约达人查询")
        public ComuserSignQryList func_comuser_sign_qry(HttpServletRequest request, String jsonpcallback){
            MiddleComuserSignQryForm form = getSingleParameterMapForBody(request , MiddleComuserSignQryForm.class);
            return VOUtil.setJsonpResult(leaderT2BizService.func_comuser_sign_qry(form), jsonpcallback);
        }
        //        public ComuserSignQryBackVo func_comuser_sign_qry(HttpServletRequest request, String jsonpcallback){
        //            ComuserSignQryForm form = getSingleParameterMapForBody(request , ComuserSignQryForm.class);
        //                return VOUtil.setJsonpResult(ledT2Service.func_comuser_sign_qry(form), jsonpcallback);
        ////            return VOUtil.setJsonpResult(leaderT2BizService.func_comuser_sign_qry(form), jsonpcallback);
        //        }

        /**
         * 用户基本信息查询(投顾)
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/user_basic_infomation_qry")
        @SaveLog(remark = "用户基本信息查询")
        public BasicUserInfoQryVo func_basic_user_info(HttpServletRequest request, String jsonpcallback){
                BasicUserInfoForm form = getSingleParameterMapForBody(request , BasicUserInfoForm.class);
                return VOUtil.setJsonpResult(ledT2Service.func_basic_user_info(form), jsonpcallback);
        }

        /**
         * 投顾收藏取消
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/comuser_collect_cancel")
        @SaveLog(remark = "投顾收藏取消")
        public ComuserCollectCancelVo func_comuser_collect_cancel(HttpServletRequest request, String jsonpcallback){
                ComuserCollectCancelForm form = getSingleParameterMapForBody(request , ComuserCollectCancelForm.class);
                return VOUtil.setJsonpResult(ledT2Service.func_comuser_collect_cancel(form), jsonpcallback);
        }

        /**
         * 支付申请
         * @param
         * @return
         */
        @ResponseBody
        @RequestMapping("/pay_apply")
        @SaveLog(remark = "支付申请")
        public PayApplyBack func_pay_apply(HttpServletRequest request, String jsonpcallback){
                PayApplyForm form = getSingleParameterMapForBody(request, PayApplyForm.class);
                return VOUtil.setJsonpResult(payT2BizService.func_compay_apply(form), jsonpcallback);
        }


        /**
        * 支付结果
        *
        * @param
        * @return
        */
        @ResponseBody
        @RequestMapping("/pay_result")
        @SaveLog(remark = "支付结果")
        public PayConfirmBack func_pay_result(HttpServletRequest request, String jsonpcallback) {
        PayConfirmForm form = getSingleParameterMapForBody(request, PayConfirmForm.class);
        return VOUtil.setJsonpResult(payT2BizService.func_result_apply(form), jsonpcallback);
        }

        /**
        * 用户签约达人历史查询
        *
        * @param
        * @return
        */
        @ResponseBody
        @RequestMapping("/user_adviser_his_qry")
        @SaveLog(remark = "用户签约达人历史查询")
        public UserAdviserHisQryVo func_user_adviser_his_qry(HttpServletRequest request, String jsonpcallback) {
        MiddleUserAdviserHisQryForm form = getSingleParameterMapForBody(request, MiddleUserAdviserHisQryForm.class);
        //        return VOUtil.setJsonpResult(ledT2Service.func_user_adviser_his_qry(form), jsonpcallback);
        return VOUtil.setJsonpResult(leaderT2BizService.func_user_adviser_his_qry(form), jsonpcallback);
        }

        /**
        * 个股关联投顾信息查询
        *
        * @param
        * @return
        */
        @ResponseBody
        @RequestMapping("/prodcode_adviser_his_qry")
        @SaveLog(remark = "个股关联投顾信息查询")
        public ProdcodeAdviserHisQryVo func_prodcode_adviser_his_qry(HttpServletRequest request, String jsonpcallback) {
        ProdcodeAdviserHisQryForm form = getSingleParameterMapForBody(request, ProdcodeAdviserHisQryForm.class);
        return VOUtil.setJsonpResult(ledT2Service.func_prodcode_adviser_his_qry(form), jsonpcallback);
        }

        /**
        * 批量个股委托投资依据修改
        *
        * @param
        * @return
        */
        @ResponseBody
        @RequestMapping("/comentrust_detail_reason_mod")
        @SaveLog(remark = "批量个股委托投资依据修改")
        public ComentrustDetailReasonModVo func_comentrust_detail_reason_mod(HttpServletRequest request, String jsonpcallback){
        ComentrustDetailForm form = getSingleParameterMapForBody(request, ComentrustDetailForm.class);
        return VOUtil.setJsonpResult(ledT2Service.func_comentrust_detail_reason_mod(form), jsonpcallback);
        }



        /**
        * 东北根据资金账号、投顾ID查询签约状态
        *
        * @param
        * @return
        */
        @ResponseBody
        @RequestMapping("/dongbei_sign_status")
        @SaveLog(remark = "东北根据资金账号、投顾ID查询签约状态")
        public DongbeiSignStatusBack func_dongbei_sign_status(HttpServletRequest request, String jsonpcallback){
        DongbeiSignStatusForm form = getSingleParameterMapForBody(request, DongbeiSignStatusForm.class);
        return VOUtil.setJsonpResult(comUserSignT2BizService.func_dongbei_sign_status(form), jsonpcallback);
        }
        /**
        * 东北签约成功回调
        *
        * @param
        * @return
        */
        @ResponseBody
        @RequestMapping("/dongbei_sign_callback")
        @SaveLog(remark = "东北签约成功回调")
        public DongbeiSignCallbackBack func_dongbei_sign_callback(HttpServletRequest request, String jsonpcallback){
        DongbeiSignCallbackForm form = getSingleParameterMapForBody(request, DongbeiSignCallbackForm.class);
        return VOUtil.setJsonpResult(comUserSignT2BizService.func_dongbei_sign_callback(form), jsonpcallback);
        }
        /**
        * 东北获取银联支付报文
        *
        * @param
        * @return
        */
        @ResponseBody
        @RequestMapping("/dongbei_pay_html")
        @SaveLog(remark = "东北获取银联支付报文")
        public DongbeiPayHtmlBack func_dongbei_pay_html(HttpServletRequest request, String jsonpcallback){
        DongbeiPayHtmlForm form = getSingleParameterMapForBody(request, DongbeiPayHtmlForm.class);
        return VOUtil.setJsonpResult(payT2BizService.func_dongbei_pay_html(form), jsonpcallback);
        }


        @ResponseBody
        @RequestMapping("/ping_plus_pay_apply")
        @SaveLog(remark = "支付申请，（后台以及Ping++)")
        public PingPlusPayApplyBack func_ping_pay_apply(HttpServletRequest request, String jsonpcallback){
                PingPlusPayApplyForm form = getSingleParameterMapForBody(request, PingPlusPayApplyForm.class);
                form.setClient_ip(IPUtil.getIpAddress(request));
                return VOUtil.setJsonpResult(payT2BizService.func_ping_pay_apply(form), jsonpcallback);
        }


        @ResponseBody
        @RequestMapping("/ping_plus_pay_oper")
        @SaveLog(remark = "Ping++支付申请操作")
        public PingPlusPayApplyBack func_ping_pay_oper(HttpServletRequest request, String jsonpcallback){
                PingPlusPayOper form = getSingleParameterMapForBody(request, PingPlusPayOper.class);
                form.setClient_ip(IPUtil.getIpAddress(request));
                return VOUtil.setJsonpResult(payT2BizService.func_ping_pay_oper(form), jsonpcallback);
        }


        @ResponseBody
        @RequestMapping("/cancel_pay_apply")
        @SaveLog(remark = "支付取消")
        public HSBCPSBackVO func_cancel_pay_apply(HttpServletRequest request, String jsonpcallback){
                PayCancelForm form = getSingleParameterMapForBody(request, PayCancelForm.class);
                return VOUtil.setJsonpResult(payT2BizService.func_cancel_pay_apply(form), jsonpcallback);
        }


        @ResponseBody
        @RequestMapping("/webhooks_callback")
        @SaveLog(remark = "Ping++支付回调")
        public void func_webhooks_callback(HttpServletRequest request, String callback){
                String signature = request.getHeader("X-Pingplusplus-Signature");
                String webhooksRawPostData = null;
                try {
                        InputStream inStream = request.getInputStream();
                        if(inStream != null) {
                                ByteArrayOutputStream outStream = new ByteArrayOutputStream();
                                byte[] tempBytes = new byte[1024];
                                int count = -1;
                                while ((count = inStream.read(tempBytes, 0, 1024)) != -1) {
                                        outStream.write(tempBytes, 0, count);
                                }
                                tempBytes = null;
                                outStream.flush();
                                webhooksRawPostData = new String(outStream.toByteArray(), "UTF-8");
                        }
                } catch (IOException e) {
                        e.printStackTrace();
                }

                WebhooksForm form = new WebhooksForm();
                form.setSignature(signature);
                form.setWebhooksRawPostData(webhooksRawPostData);
                HSBCPSBackVO backVO = payT2BizService.func_webhooks_callback(form);
                if(!"0".equals(backVO.getError_no())){
                        throw  new RuntimeException("支付回调不成功！");
                }
        }


        @ResponseBody
        @RequestMapping("/dongbei_trans_auth_login")
        @SaveLog(remark = "东北资金交易登录校验")
        public TradLoginBackVo func_dongbei_trans_auth_login(HttpServletRequest request, String jsonpcallback){
                LoginAuthForm form = getSingleParameterMapForBody(request, LoginAuthForm.class);
                return VOUtil.setJsonpResult(ledThreeT2Service.func_dongbei_trans_auth_login(form), jsonpcallback);
        }

        @ResponseBody
        @RequestMapping("/dongbei_trans_login")
        @SaveLog(remark = "东北资金交易登录")
        public TradLoginBackVo func_dongbei_trans_login(HttpServletRequest request, String jsonpcallback){
                TradLoginForm form = getSingleParameterMapForBody(request, TradLoginForm.class);
                return VOUtil.setJsonpResult(ledThreeT2Service.func_dongbei_trans_login(form), jsonpcallback);
        }



}
